package org.zn.note.spring.tools;

import org.springframework.util.StopWatch;

import java.util.concurrent.TimeUnit;

public class StopWatchExample {
    public static void main(String[] args) throws InterruptedException {

        StopWatch stopWatch = new StopWatch();

        stopWatch.start("查询交易数据");
        // 这里执行任务，查询交易数据，db.query(trans)
        TimeUnit.SECONDS.sleep(1);
        stopWatch.stop();

        stopWatch.start("查询结算数据");
        TimeUnit.SECONDS.sleep(2);
        stopWatch.stop();

        System.out.println(stopWatch.prettyPrint());
    }
}
